<template>
  <div>
    <div style="margin-bottom: 10px; width: 300px;">
      <Input v-model="keyword" class="search-full" search enter-button placeholder="请输入你想查询的编号" @on-enter="searchFull" @on-search="searchFull" />
    </div>

    <Card>
      <tables :loading="loading" stripe  ref="tables" v-model="tableData" :columns="columns"/>
    </Card>
  </div>
</template>

<script>
import Tables from '_c/tables'
import { apiAuthKeySearch } from '@/api/authKey'
import { Message } from 'view-design'
import {apiResult} from "@/libs/util";

export default {
  name: 'list_page',
  components: {
    Tables
  },
  data () {
    return {
      columns: [
        { title: 'key', key: 'key', sortable: false },
        { title: 'value', key: 'value', sortable: false }
      ],
      tableData: [],
      keyword: '',
      loading: false,

    }
  },
  methods: {
    searchFull () {
      if (!this.keyword) {
        return
      }
      this.loading = true
      apiAuthKeySearch(this.keyword).then(res => {
        apiResult(res.data,false,result=>{
          this.tableData = result.data
          this.loading = false
        })
        /*if (code === 0) {
          this.tableData = res.data.data
          this.loading = false
        } else {
          Message.error('数据获取失败，原因：' + res.data.msg)
        }*/
      })
    }
  },
  mounted () {
  }
}
</script>

<style lang="less">
  @import "./AuthKeySearch";
</style>
